package org.dromara.system.service;

import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.system.domain.bo.SysFaultInfoEnBo;
import org.dromara.system.domain.bo.SysFaultInfoEnQueryBo;
import org.dromara.system.domain.bo.SysFaultManageEnBo;
import org.dromara.system.domain.vo.SysFaultInfoEnVo;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.springframework.web.multipart.MultipartFile;

/**
 * English Fault Information Service Interface
 * Provides integrated management functions for fault information and solutions
 *
 * @author system
 */
public interface ISysFaultInfoEnService {

    // ==================== Query Interfaces ====================

    /**
     * Query fault information list (paginated)
     *
     * @param queryBo   Query parameters
     * @param pageQuery Pagination parameters
     * @return Paginated fault information list
     */
    TableDataInfo<SysFaultInfoEnVo> queryPageList(SysFaultInfoEnQueryBo queryBo, PageQuery pageQuery);

    /**
     * Query fault information list (non-paginated)
     *
     * @param queryBo Query parameters
     * @return Fault information list
     */
    List<SysFaultInfoEnVo> queryList(SysFaultInfoEnQueryBo queryBo);

    /**
     * Query fault information detail (including complete solution information)
     *
     * @param faultId Fault ID
     * @return Fault information detail
     */
    SysFaultInfoEnVo queryById(Long faultId);

    // ==================== Cascade Query Interfaces ====================

    /**
     * Get all excavator model list
     *
     * @return Excavator model list
     */
    List<String> getExcavatorModelList();

    /**
     * Get fault part list by excavator model
     *
     * @param excavatorModel Excavator Model
     * @return Fault part list
     */
    List<String> getFaultPartList(String excavatorModel);

    /**
     * Get fault symptom list by excavator model and fault part
     *
     * @param excavatorModel Excavator Model
     * @param faultPart     Fault Part
     * @return Fault symptom list
     */
    List<String> getFaultSymptomList(String excavatorModel, String faultPart);

    /**
     * Get fault detail list by excavator model, fault part, and fault symptom (Level 4 query)
     *
     * @param excavatorModel Excavator Model
     * @param faultPart     Fault Part
     * @param faultSymptom  Fault Symptom
     * @return Fault detail list
     */
    List<Map<String, Object>> getFaultDetailList(String excavatorModel, String faultPart, String faultSymptom);

    // ==================== Basic CRUD Interfaces ====================

    /**
     * Add fault information (basic version)
     *
     * @param bo Fault information
     * @return Result
     */
    Boolean insertByBo(SysFaultInfoEnBo bo);

    /**
     * Update fault information (basic version)
     *
     * @param bo Fault information
     * @return Result
     */
    Boolean updateByBo(SysFaultInfoEnBo bo);

    /**
     * Validate and batch delete fault information (basic version)
     *
     * @param ids     Fault information ID collection to delete
     * @param isValid Whether to validate, true-validate before deletion, false-no validation
     * @return Result
     */
    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);

    // ==================== Integrated Management Interfaces (Recommended) ====================

    /**
     * Integrated creation: Add fault information and solution
     * 
     * @param manageBo Fault management composite BO
     * @param files    Solution files (optional)
     * @return Complete fault information (including solution)
     */
    SysFaultInfoEnVo createFaultWithSolution(SysFaultManageEnBo manageBo, MultipartFile[] files);

    /**
     * Integrated update: Update fault information and solution
     * 
     * @param manageBo Fault management composite BO
     * @param files    Solution files (optional)
     * @return Complete fault information (including solution)
     */
    SysFaultInfoEnVo updateFaultWithSolution(SysFaultManageEnBo manageBo, MultipartFile[] files);

    /**
     * Integrated deletion: Delete fault information and related solution
     * 
     * @param ids               Fault ID collection
     * @param cascadeStrategy   Cascade deletion strategy
     *                         - auto: Auto decide (delete solution only when referenced only by current fault)
     *                         - yes: Force delete solution
     *                         - no: Do not delete solution
     * @return Deletion result
     */
    Boolean deleteFaultWithCascade(Collection<Long> ids, String cascadeStrategy);

    // ==================== Compatibility Interfaces (Deprecated, Keep for Compatibility) ====================

    /**
     * @deprecated Use createFaultWithSolution instead
     */
    @Deprecated
    SysFaultInfoEnVo createWithSolution(SysFaultInfoEnBo faultBo,
                                      MultipartFile[] files,
                                      String folderName,
                                      String remark,
                                      String action,
                                      Long linkDocId);

    /**
     * @deprecated Use updateFaultWithSolution instead
     */
    @Deprecated
    SysFaultInfoEnVo updateWithSolution(SysFaultInfoEnBo faultBo,
                                      MultipartFile[] files,
                                      String folderName,
                                      String remark,
                                      String action,
                                      Long linkDocId,
                                      Boolean deleteOld);

    /**
     * @deprecated Use deleteFaultWithCascade instead
     */
    @Deprecated
    Boolean deleteWithCascade(Collection<Long> ids, String cascadeStrategy);
}

